<Histogram>
{let $answer := doc("responses.xml")/CLASS/STUDENT/RESPONSES/MCRESPONSE[@qID="prefs"]/ANSWER
for $choice in doc("survey.xml")/SURVEY/QUESTION[@questionID="prefs"]/MCQUESTION/CHOICE
return <Bar choice="{$choice}" count="{count($answer[.=$choice])}"/>}
</Histogram>